import GSTC from "gantt-schedule-timeline-calendar/dist/gstc.wasm.esm.min.js";
const GSTCID = GSTC.api.GSTCID;
const colors = [
  "#E74C3C",
  "#DA3C78",
  "#7E349D",
  "#0077C0",
  "#07ABA0",
  "#0EAC51",
  "#F1892D",
];
const setTime = (y, m, d) => {
  return GSTC.api
    .date()
    .set("year", y)
    .set("month", m - 1)
    .set("date", d)
    .startOf("day")
    .add(7, "hour")
    .valueOf();
};
const setEndTime = (start) => {
  return GSTC.api.date(start).add(12, "hour").endOf("hour");
};
const data = [
  {
    row: {
      id: GSTCID("1"),
      task: "总进度计划",
      startTime: setTime(2019, 10, 25),
      endTime: setTime(2021, 10, 30),
      taskTime: "669",
      level: 1,
      isSelect: false,
    },
    item: {
      id: GSTCID("1"),
      rowId: GSTCID("1"),
      label: "1",
      time: {
        start: setTime(2019, 10, 25).valueOf(),
        end: setEndTime(setTime(2019, 10, 25)).valueOf(),
      },
      style: {
        display: "none",
        backgroundColor: colors[Math.floor(Math.random() * 5)],
      },
    },
  },
  {
    row: {
      id: GSTCID("2"),
      task: "地下部分",
      startTime: setTime(2019, 10, 25),
      endTime: setTime(2021, 3, 20),
      taskTime: "445",
      parentId: GSTCID("1"),
      level: 2,
    },
    item: {
      id: GSTCID("2"),
      rowId: GSTCID("2"),
      label: "2",
      time: {
        start: setTime(2019, 10, 25).valueOf(),
        end: setEndTime(setTime(2019, 10, 25)).valueOf(),
      },
      style: {
        display: "none",
        backgroundColor: colors[Math.floor(Math.random() * 5)],
      },
    },
  },
  {
    row: {
      id: GSTCID("3"),
      task: "地下车库主体结枸",
      startTime: setTime(2020, 4, 20),
      endTime: setTime(2020, 7, 18),
      taskTime: "90",
      parentId: GSTCID("2"),
      level: 3,
    },
    item: {
      id: GSTCID("3"),
      rowId: GSTCID("3"),
      label: "3",
      before: [],
      time: {
        start: setTime(2020, 4, 20).valueOf(),
        end: setEndTime(setTime(2020, 4, 20)).valueOf(),
      },
      style: { backgroundColor: colors[Math.floor(Math.random() * 5)] },
    },
  },
  {
    row: {
      id: GSTCID("4"),
      task: "地下室侧墙防水及回填",
      startTime: setTime(2020, 5, 30),
      endTime: setTime(2020, 8, 27),
      taskTime: "90",
      parentId: GSTCID("2"),
      level: 3,
    },
    item: {
      id: GSTCID("4"),
      rowId: GSTCID("4"),
      label: "4",
      before: [],
      time: {
        start: setTime(2020, 5, 30).valueOf(),
        end: setEndTime(setTime(2020, 5, 30)).valueOf(),
      },
      style: { backgroundColor: colors[Math.floor(Math.random() * 5)] },
    },
  },
  {
    row: {
      id: GSTCID("5"),
      task: "地下室二次结构",
      startTime: setTime(2020, 9, 1),
      endTime: setTime(2020, 10, 20),
      taskTime: "50",
      parentId: GSTCID("2"),
      level: 3,
    },
    item: {
      id: GSTCID("5"),
      rowId: GSTCID("5"),
      label: "5",
      before: [],
      time: {
        start: setTime(2020, 9, 1).valueOf(),
        end: setEndTime(setTime(2020, 9, 1)).valueOf(),
      },
      style: { backgroundColor: colors[Math.floor(Math.random() * 5)] },
    },
  },
  {
    row: {
      id: GSTCID("6"),
      task: "地下室墙体排灰",
      startTime: setTime(2020, 10, 1),
      endTime: setTime(2020, 11, 19),
      taskTime: "50",
      parentId: GSTCID("2"),
      level: 3,
    },
    item: {
      id: GSTCID("6"),
      rowId: GSTCID("6"),
      label: "6",
      before: [],
      time: {
        start: setTime(2020, 10, 1).valueOf(),
        end: setEndTime(setTime(2020, 10, 1)).valueOf(),
      },
      style: { backgroundColor: colors[Math.floor(Math.random() * 5)] },
    },
  },
  {
    row: {
      id: GSTCID("7"),
      task: "桩基工程",
      startTime: setTime(2019, 10, 25),
      endTime: setTime(2019, 12, 31),
      taskTime: "50",
      parentId: GSTCID("2"),
      level: 3,
    },
    item: {
      id: GSTCID("7"),
      rowId: GSTCID("7"),
      label: "7",
      before: [],
      lineContent: "桩基工程 工期50天",
      time: {
        start: setTime(2019, 10, 25).valueOf(),
        end: setEndTime(setTime(2019, 10, 25)).valueOf(),
      },
      style: { backgroundColor: colors[Math.floor(Math.random() * 5)] },
      dependant: [GSTCID("8")],
    },
  },
  {
    row: {
      id: GSTCID("8"),
      task: "桩芯土清理倒运",
      startTime: setTime(2019, 10, 30),
      endTime: setTime(2020, 3, 20),
      taskTime: "96",
      parentId: GSTCID("2"),
      level: 3,
    },
    item: {
      id: GSTCID("8"),
      rowId: GSTCID("8"),
      label: "8",
      before: [],
      time: {
        start: setTime(2019, 10, 30).valueOf(),
        end: setEndTime(setTime(2019, 10, 30)).valueOf(),
      },
      style: { backgroundColor: colors[Math.floor(Math.random() * 5)] },
      dependant: [GSTCID("9"), GSTCID("10")],
    },
  },
  {
    row: {
      id: GSTCID("9"),
      task: "桩帽施工,桩基静载",
      startTime: setTime(2020, 1, 6),
      endTime: setTime(2020, 3, 16),
      taskTime: "24",
      parentId: GSTCID("2"),
      level: 3,
    },
    item: {
      id: GSTCID("9"),
      rowId: GSTCID("9"),
      label: "9",
      before: [],
      time: {
        start: setTime(2020, 1, 6).valueOf(),
        end: setEndTime(setTime(2020, 1, 6)).valueOf(),
      },
      style: { backgroundColor: colors[Math.floor(Math.random() * 5)] },
    },
  },
  {
    row: {
      id: GSTCID("10"),
      task: "桩间土方开挖、桩头碱碎",
      startTime: setTime(2020, 3, 21),
      endTime: setTime(2020, 4, 29),
      taskTime: "40",
      parentId: GSTCID("2"),
      level: 3,
    },
    item: {
      id: GSTCID("10"),
      rowId: GSTCID("10"),
      label: "10",
      before: [],
      time: {
        start: setTime(2020, 3, 21).valueOf(),
        end: setEndTime(setTime(2020, 3, 21)).valueOf(),
      },
      style: { backgroundColor: colors[Math.floor(Math.random() * 5)] },
    },
  },
  {
    row: {
      id: GSTCID("11"),
      task: "塔吊桩,工程桩破桩头",
      startTime: setTime(2020, 3, 26),
      endTime: setTime(2020, 5, 4),
      taskTime: "40",
      parentId: GSTCID("2"),
      level: 3,
    },
    item: {
      id: GSTCID("11"),
      rowId: GSTCID("11"),
      label: "11",
      before: [],
      time: {
        start: setTime(2020, 3, 26).valueOf(),
        end: setEndTime(setTime(2020, 3, 26)).valueOf(),
      },
      style: { backgroundColor: colors[Math.floor(Math.random() * 5)] },
    },
  },
  {
    row: {
      id: GSTCID("12"),
      task: "地下室装饰装修",
      startTime: setTime(2020, 11, 20),
      endTime: setTime(2021, 9, 20),
      taskTime: "100",
      parentId: GSTCID("2"),
      level: 3,
    },
    item: {
      id: GSTCID("12"),
      rowId: GSTCID("12"),
      label: "12",
      before: [],
      time: {
        start: setTime(2020, 11, 20).valueOf(),
        end: setEndTime(setTime(2020, 11, 20)).valueOf(),
      },
      style: { backgroundColor: colors[Math.floor(Math.random() * 5)] },
    },
  },
  {
    row: {
      id: GSTCID("13"),
      task: "商业A",
      startTime: setTime(2020, 7, 19),
      endTime: setTime(2021, 5, 15),
      taskTime: "280",
      parentId: GSTCID("1"),
      level: 2,
    },
    item: {
      id: GSTCID("13"),
      rowId: GSTCID("13"),
      label: "13",
      before: [],
      time: {
        start: setTime(2020, 7, 19).valueOf(),
        end: setEndTime(setTime(2020, 7, 19)).valueOf(),
      },
      style: { backgroundColor: colors[Math.floor(Math.random() * 5)] },
    },
  },
  {
    row: {
      id: GSTCID("14"),
      task: "商业A及地库门窗工程",
      startTime: setTime(2020, 10, 17),
      endTime: setTime(2021, 1, 24),
      taskTime: "100",
      parentId: GSTCID("13"),
      level: 3,
    },
    item: {
      id: GSTCID("14"),
      rowId: GSTCID("14"),
      label: "14",
      before: [],
      time: {
        start: setTime(2020, 10, 17).valueOf(),
        end: setEndTime(setTime(2020, 10, 17)).valueOf(),
      },
      style: { backgroundColor: colors[Math.floor(Math.random() * 5)] },
    },
  },
  {
    row: {
      id: GSTCID("15"),
      task: "商业A主体结构",
      startTime: setTime(2020, 7, 19),
      endTime: setTime(2020, 9, 16),
      taskTime: "60",
      parentId: GSTCID("13"),
      level: 3,
    },
    item: {
      id: GSTCID("15"),
      rowId: GSTCID("15"),
      label: "15",
      before: [],
      time: {
        start: setTime(2020, 7, 19).valueOf(),
        end: setEndTime(setTime(2020, 7, 19)).valueOf(),
      },
      style: { backgroundColor: colors[Math.floor(Math.random() * 5)] },
    },
  },
  {
    row: {
      id: GSTCID("16"),
      task: "商业A二次结构",
      startTime: setTime(2020, 9, 17),
      endTime: setTime(2020, 10, 16),
      taskTime: "30",
      parentId: GSTCID("13"),
      level: 3,
    },
    item: {
      id: GSTCID("16"),
      rowId: GSTCID("16"),
      label: "16",
      before: [],
      time: {
        start: setTime(2020, 9, 17).valueOf(),
        end: setEndTime(setTime(2020, 9, 17)).valueOf(),
      },
      style: { backgroundColor: colors[Math.floor(Math.random() * 5)] },
    },
  },
  {
    row: {
      id: GSTCID("17"),
      task: "商业A及地库门窗工程",
      startTime: setTime(2020, 10, 17),
      endTime: setTime(2020, 11, 15),
      taskTime: "30",
      parentId: GSTCID("13"),
      level: 3,
    },
    item: {
      id: GSTCID("17"),
      rowId: GSTCID("17"),
      label: "17",
      before: [],
      time: {
        start: setTime(2020, 10, 17).valueOf(),
        end: setEndTime(setTime(2020, 10, 17)).valueOf(),
      },
      style: { backgroundColor: colors[Math.floor(Math.random() * 5)] },
    },
  },
  {
    row: {
      id: GSTCID("18"),
      task: "商业A及地库门窗工程",
      startTime: setTime(2021, 1, 25),
      endTime: setTime(2021, 5, 15),
      taskTime: "90",
      parentId: GSTCID("13"),
      level: 3,
    },
    item: {
      id: GSTCID("18"),
      rowId: GSTCID("18"),
      label: "18",
      before: [],
      time: {
        start: setTime(2021, 1, 25).valueOf(),
        end: setEndTime(setTime(2021, 1, 25)).valueOf(),
      },
      style: { backgroundColor: colors[Math.floor(Math.random() * 5)] },
    },
  },
];
export default data;
